Conversation
VatsalSy
commented
Apr 24, 2025
- Added theme initialization script to layouts
- Changed featured
📝 WalkthroughSummary by CodeRabbit
Summary by CodeRabbit
WalkthroughA new inline script for initializing the website's theme based on user preference or system settings was introduced via the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Browser
participant theme-init.html
User->>Browser: Loads page
Browser->>theme-init.html: Executes inline script
theme-init.html->>Browser: Checks localStorage for 'theme'
alt Theme found in localStorage
theme-init.html->>Browser: Set data-theme to stored value
else No theme in localStorage
theme-init.html->>Browser: Check prefers-color-scheme
alt Prefers dark
theme-init.html->>Browser: Set data-theme to 'dark'
else Prefers light
theme-init.html->>Browser: Set data-theme to 'light'
end
end
Browser->>User: Renders page with selected theme
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
_layouts/default.html (1)
4-4: Ensure theme-init.html is included early and consider DRY refactor
Including the theme-init partial at the very top of<head>guarantees correct initial theme. Verify that_includes/theme-init.htmlexists and is spelled correctly. To reduce duplication across layouts, you could extract common<head>elements (meta tags, preload links, theme-init include) into a shared include._layouts/team.html (1)
4-4: Verify inclusion of theme-init partial in team layout
Including the partial here is correct to apply the theme before other head content. As a future improvement, centralize repeated head markup (including this include) in a single snippet to ease maintenance across all layouts._layouts/research.html (1)
4-4: Confirm theme-init inclusion in research layout
Placement of{% include theme-init.html %}as the first line in<head>is appropriate. To avoid having to update multiple layouts for future head changes, consider moving shared head elements into one include file._layouts/teaching.html (1)
4-4: Validate theme-init inclusion in teaching layout
This aligns with other layouts by setting the theme early. For maintainability, you might consolidate all common head setup into one include and then include it here (and in other layouts) instead of repeating.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
_includes/theme-init.html(1 hunks)_layouts/default.html(1 hunks)_layouts/research.html(1 hunks)_layouts/teaching-course.html(2 hunks)_layouts/teaching.html(1 hunks)_layouts/team.html(1 hunks)_research/index.md(2 hunks)
🔇 Additional comments (3)
_research/index.md (2)
61-61: Removed “Featured” tag from the 2025 paper — looks correct.
The removal of the<span>Featured</span>tag on entry[15]aligns with the updated prioritization. No further adjustments appear necessary.
127-127: Added “Featured” tag to the 2023 paper — correct assignment.
Marking entry[11]as featured now matches the PR objectives. Ensure that any client-side or build filters rendering “Featured” entries pick up this change._layouts/teaching-course.html (1)
4-4:Details
✅ Verification successful
Insert theme-init include at top of
<head>— correct.
Includingtheme-init.htmlas the first child of<head>ensures theme logic runs before any other head content. Please verify the same inclusion exists consistently in all other layout templates.Run this script to confirm:
🏁 Script executed:
#!/bin/bash # Search all layout files for the theme-init include rg -n "{% include theme-init.html %}" _layoutsLength of output: 153
🏁 Script executed:
#!/bin/bash # Search all layout files for the theme-init include using fixed-string matching rg -F '{% include theme-init.html %}' -n _layoutsLength of output: 338
Confirmed consistent inclusion of
theme-init.htmlat top of<head>in all layout templates.Verification (include present at line 4 in):
- _layouts/default.html
- _layouts/team.html
- _layouts/teaching.html
- _layouts/teaching-course.html
- _layouts/research.html
No further action required.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>